You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor(pathfinder): add a search context resolved per platform - #3605
Most of the SearchPlatform protocol only selects descriptor fields for one platform. This adds that selection as plain data: a frozen SearchContext record, built by linux_search_context() or windows_search_context(). Each platform's rules now read as one table.
Nothing uses the record yet. A new test checks that it equals the existing platform classes for every catalog entry on Linux, Windows x64 and Windows arm64 (150 cases). The next change switches the search steps over and removes the classes.
No behavior change. 1795 passed, 6 skipped.
For the reviewer: this PR and #3606 are split on purpose. This one adds the record and proves it equals the existing classes. #3606 switches the search steps to it and deletes the classes and the comparison test.
Testing
Full cuda_pathfinder test suite at this commit: 1795 passed, 6 skipped (Linux, Python 3.14).
pre-commit clean, including mypy-pathfinder.
Not run on Windows. Windows rules are exercised by tests that simulate Windows on Linux.
PLC Local Security Evidence (Advisory)
Local advisory checks only, run over the whole stack. Not release-gate results.
Check
Status
Tool
Details
Secrets
SKIP
Pulse Secret Scanner
scanner image not available locally (registry login); the repo trufflehog pre-commit hook passed
SAST
WARN
Semgrep
1 finding, not from this stack: the existing subprocess.run call in the canary probe in load_nvidia_dynamic_lib.py
Dependencies
WARN
pip-audit / osv-scanner
no manifest or lockfile in scope, so the local scan could not run; this stack changes no dependencies
Reviewing files that changed from the base of the PR and between af4c0e3 and 229e8b6.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
Improvements
Library discovery now accounts for the operating system and target architecture when checking search locations. On Windows, it uses architecture-specific directories and applies compatibility checks where needed; Linux discovery uses its corresponding platform settings. This supports more consistent library discovery across supported environments.
Adds a SearchContext dataclass and factory functions that resolve library search inputs for Linux, Windows, or the current platform. Tests compare the resolved values with platform methods for each library descriptor.
Changes: Platform Search Context
Layer / File(s)
Summary
Resolve and verify platform search inputs cuda_pathfinder/cuda/pathfinder/_dynamic_libs/search_platform.py, cuda_pathfinder/tests/test_search_steps.py
SearchContext stores platform-resolved search inputs. Factory functions populate the context for Linux or Windows, with Windows settings selected by target architecture. Parametrized tests compare context values with platform methods for Linux and Windows x64 and arm64.
Possibly related PRs
NVIDIA/cuda-python#3606: Moves search steps to read the SearchContext record introduced here.
NVIDIA/cuda-python#3607: Changes the SearchContext record and updates search steps to return FindResult or NotFound.
Suggested reviewers:cpcloud
Change: Refactor
Merge Risk: Minimal · previous review af4c0
This change adds a data record and factory functions that nothing in the package calls yet. Runtime behavior is unchanged and no merge-blocking risk was found.
Security architecture risk: Minimal · up to af4c0
The new search settings are not used by the library loader in this PR. The public API, active search behavior, and library-loading controls remain unchanged.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
inferred — The additive contract does not expand reachability to native library loading through the public API: the existing loader retains its original context binding, and the new factories are not exported by the package.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 1 remain after this review.
Most of the `SearchPlatform` protocol only selects descriptor fields for
one platform. This adds that selection as plain data: a frozen
`SearchContext` record, built by `linux_search_context()` or
`windows_search_context()`. Each platform's rules now read as one table.
Nothing uses the record yet. A new test checks that it equals the
existing platform classes for every catalog entry on Linux, Windows x64
and Windows arm64 (150 cases). The next change switches the search steps
over and removes the classes.
No behavior change. 1795 passed, 6 skipped.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Rob Parolin <rparolin@nvidia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
— codex on behalf of Ralf —
Description
Part 5 of 23 of a readability stack for
cuda.pathfinder(stack: #3623 → #3602 → #3603 → #3604 → #3605 → #3606 → #3607 → #3608 → #3609 → #3610 → #3611 → #3613 → #3618 → #3619 → #3620 → #3621 → #3622 → #3627 → #3628 → #3629 → #3630 → #3631 → #3632). No behavior change.Most of the
SearchPlatformprotocol only selects descriptor fields for one platform. This adds that selection as plain data: a frozenSearchContextrecord, built bylinux_search_context()orwindows_search_context(). Each platform's rules now read as one table.Nothing uses the record yet. A new test checks that it equals the existing platform classes for every catalog entry on Linux, Windows x64 and Windows arm64 (150 cases). The next change switches the search steps over and removes the classes.
No behavior change. 1795 passed, 6 skipped.
For the reviewer: this PR and #3606 are split on purpose. This one adds the record and proves it equals the existing classes. #3606 switches the search steps to it and deletes the classes and the comparison test.
Testing
cuda_pathfindertest suite at this commit: 1795 passed, 6 skipped (Linux, Python 3.14).mypy-pathfinder.PLC Local Security Evidence (Advisory)
Local advisory checks only, run over the whole stack. Not release-gate results.
subprocess.runcall in the canary probe inload_nvidia_dynamic_lib.pyChecklist
🤖 Generated with Claude Code